package cn.leedsoft.and.crimeintent.controller.photo_gallery;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by leeds on 2016/9/5 9:44.
 */
public class NotificationReceiver extends BroadcastReceiver {//Ordered Broadcast，隐藏通知消息
    private static final String TAG = "NotificationReceiver";


    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "received result : " + getResultCode());
        if (getResultCode() != Activity.RESULT_OK) {
            return;
        }
        int requestCode = intent.getIntExtra(PollService.BROADCAST_REQUEST_CODE_KEY, 0);
        Notification notification = intent.getParcelableExtra(PollService.BROADCAST_NOTIFICATION);

        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(requestCode, notification);
    }
}
